<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <div id='root'>
        <div>computed:</div>
        <div :title="message">{{total}}</div>  
        <div>methods:</div>
        <div>{{getTotal()}}</div>
        <div>watch:</div>
        <div>{{newTotal}}</div>
    </div>
    <script>
        let app = Vue.createApp({
            data() {
                return {
                    price:3,
                    number:2,
                    newTotal:''
                }
            },
            computed:{
                total(){
                    return this.price * this.number;
                }
            },
            watch:{
                price(current, prev){
                    setTimeout(()=>{
                        console.log('current:',current)
                        console.log('number:',this.number)
                        this.newTotal = current * this.number
                    },2000)
                }
            },
            methods:{
             getTotal(){
                return this.price * this.number;
             }
            }
        })

        let vm = app.mount('#root')
    </script>
</body>
</html>